package org.example.common.configs.queue.disruptor;

import lombok.Data;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * @author weigang
 * @create 2022-07-11 14:28
 */
@Data
@Component
public class DisruptorEventProducer implements DisposableBean {

    private DisruptorEventProducerWorker worker;


    public void publishEvent(Serializable event) {
        worker.publishEvent(event);
    }

    @Override
    public void destroy() throws Exception {
        worker.destroy();
    }
}
